#ifndef UI_TRANSLATIONS_H
#define UI_TRANSLATIONS_H

#include <string>
#include <unordered_map>

#include <crow/json.h>

namespace Ui
{

class Translations final
{
public:
    static Translations& getInstance();

public:
    crow::json::wvalue data(const std::string& lang) const;
    std::vector<std::string> langs() const;
    std::string defaultLang() const;

private:
    void loadLang(const std::string& lang);

private:
    Translations();
    Translations(const Translations&) = delete;
    Translations& operator=(const Translations&) = delete;

private:
    std::unordered_map<std::string, crow::json::wvalue> m_data;
};

#define defaultTranslation Translations::getInstance().data("")

} // namespace Ui

#endif // UI_TRANSLATIONS_H
